'use strict';
module.exports = (app) => {
  const { STRING, INTEGER, TEXT } = app.Sequelize;
  const Character = app.model.define('w_character', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    name: {
      comment: '名字',
      type: TEXT('long'),
    },
    position: {
      comment: '职位',
      type: TEXT('long'),
    },
    resume: {
      comment: '履历',
      type: TEXT('long'),
    },
    projectId: {
      comment: '项目id',
      type: INTEGER,
      allowNull: false,
    },
  });
  Character.associate = function () {
    app.model.Tables.Web.Character.hasMany(app.model.Tables.Web.Case, {
      foreignKey: 'characterId',
    });
  };
  return Character;
};
